Remove deepmerge in favor of a local implementation - #8281
Draft
isaacroldan wants to merge 1 commit into
Draft
Conversation
deepMergeObjects now uses a small local deep merge that preserves the semantics we relied on from deepmerge v4: custom array merge strategies, cloning of nested values, treating Date and RegExp as leaf values, and skipping unsafe keys like __proto__. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Part of an effort to reduce external dependencies in the CLI.
deepmergeis used in a single function (deepMergeObjectsincli-kit), and the subset of its behavior we rely on fits in ~50 lines.WHAT is this pull request doing?
Replaces the
deepmergepackage with a local implementation inpackages/cli-kit/src/public/common/object.tsthat preserves deepmerge v4 semantics as used bydeepMergeObjects:DateandRegExpare treated as leaf values, not merged into plain objects.__proto__, etc.) that exist on the prototype chain but are not own enumerable properties are skipped, keeping deepmerge's prototype-pollution guard.No changeset: internal refactor with no user-visible behavior change.
How to test your changes?
pnpm vitest run src/public/common/object.test.tsinpackages/cli-kit(29 tests pass)packages/app(app.test.ts, patch-app-configuration-file.test.ts, config/link.test.ts, select-app.test.ts, dev/extension/payload/store.test.ts — 85 tests pass)pnpm type-checkinpackages/cli-kitMeasuring impact
Checklist
🤖 Generated with Claude Code